package com.tedu.assess.controller;


import com.tedu.assess.pojo.dto.HealthParam;
import com.tedu.assess.pojo.dto.HealthQuery;
import com.tedu.assess.pojo.vo.HealthVO;
import com.tedu.assess.service.HealthService;
import com.tedu.common.response.JsonResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Slf4j
@RestController
@RequestMapping("/v1/health/addHealth/")
public class HealthController {
    @Autowired
    HealthService healthService ;


    @PostMapping("save")
    public JsonResult save(HealthParam healthParam) {
        log.debug("保存评估信息:参数={}", healthParam);
        healthService.insert(healthParam);
        return JsonResult.ok();
    }
    @GetMapping("select")
    public JsonResult select(HealthQuery healthQuery) {
        log.debug("查询评估信息:参数={}", healthQuery);
        List<HealthVO> list=healthService.select(healthQuery);
        return JsonResult.ok(list);
    }
    @PostMapping("delete/{id}")
    public JsonResult delete(@PathVariable Integer id) {
        log.debug("删除评估信息:参数={}", id);
        healthService.delete(id);
        return JsonResult.ok();
    }


}
